package com.qqtop10.manager.controller;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qqtop10.manager.model.Balance;
import com.qqtop10.manager.model.Labelling;
import com.qqtop10.manager.model.PagingArgs;
import com.qqtop10.manager.model.Result;
import com.qqtop10.manager.service.LabellingService;

@RequestMapping("/manager/labelling/")
@Controller
public class LabellingController extends BaseController{
	@Autowired
	private LabellingService labellingService;
	@RequestMapping("all.do")
	@ResponseBody
	public Result all(Labelling input){
		try {
			input.setShopname(URLDecoder.decode(input.getShopname(),"UTF-8"));
		} catch (UnsupportedEncodingException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		try {
			PagingArgs pagingArgs = getPagingArgs();
			int count = labellingService.count(input);
			List<Labelling> list = labellingService.all(input, pagingArgs);
			return page(count, list);
		} catch (Exception e) {
			return excep(e);
			// TODO: handle exception
		}
	}
}
